package com.cpj.bsyyzx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cpj.bsyyzx.entity.CaseHistory;
import com.cpj.bsyyzx.entity.HealthFile;
import com.cpj.bsyyzx.mapper.CaseHistoryMapper;
import com.cpj.bsyyzx.service.ICaseHistoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 五个臭皮匠
 * @since 2021-04-27
 */
@Service
public class CaseHistoryServiceImpl extends ServiceImpl<CaseHistoryMapper, CaseHistory> implements ICaseHistoryService {

    @Override
    public boolean add(CaseHistory caseHistory) {
        QueryWrapper<CaseHistory> wrapper = new QueryWrapper<>();
        wrapper.eq("user_name", caseHistory.getUserName());

        CaseHistory query = this.getOne(wrapper);
        if (query == null)
            return this.save(caseHistory);
        return false;

    }
}
